using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace ASP_TF2LogParser.UserControls
{
    public partial class ChatLogControl : System.Web.UI.UserControl
    {
        protected void Page_Load( object sender, EventArgs e )
        {

        }


        public string GenerateUrl( string playerId, string teamId )
        {

            string returnUrl = "";

            string playerName = string.Empty;

            LogParser.Collections.TeamList teamList = new LogParser.Collections.TeamList();
            LogParser.GameObjects.Team team = teamList.GetTeam( Convert.ToInt32( teamId ) );


            LogParser.DA.DataObjects.PlayerNameListDSTableAdapters.PlayerNameListTableAdapter pnlta = LogParser.DA.TableAdapters.PlayerNameListTableAdapter();

            playerName = ( ( LogParser.DA.DataObjects.PlayerNameListDS.PlayerNameListRow ) pnlta.PlayerNameListSelectById( playerId )[ 0 ] ).PlayerName;

            string teamColor = team.Name;

            if ( teamColor == null || ( teamColor.ToUpper() != "BLUE" && teamColor.ToUpper() != "RED" ) )
                teamColor = "Black";
            

            returnUrl = "<a style=\"color: " + teamColor + ";\" href='Player.aspx?playerId=" + playerId + "'>" + playerName + "</a>";

            return returnUrl;


        }

    }
}